<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: ThresholdDecider Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00209.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-types">Protected Types</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a>  </div>
  <div class="headertitle">
<div class="title">ThresholdDecider Class Reference<div class="ingroups"><a class="el" href="a00527.html">AnalogueModels example - Classes from the AnalogueModels example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="ThresholdDecider" --><!-- doxytag: inherits="Decider" -->
<p>A simple <a class="el" href="a00070.html" title="The basic Decider class.">Decider</a> implementation which only checks for a received signal if the receiving power is above a certain value.  
 <a href="a00209.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00237_source.html">ThresholdDecider.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ThresholdDecider:</div>
<div class="dyncontent">
<div class="center"><img src="a01039.png" border="0" usemap="#ThresholdDecider_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for ThresholdDecider:</div>
<div class="dyncontent">
<div class="center"><img src="a01040.png" border="0" usemap="#ThresholdDecider_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a01041.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a56f0b3495b47d6d0df3cfe33a169f44e"></a><!-- doxytag: member="ThresholdDecider::ThresholdDecider" ref="a56f0b3495b47d6d0df3cfe33a169f44e" args="(DeciderToPhyInterface *phy, double sensitivity, int myIndex, bool bDebug)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>ThresholdDecider</b> (<a class="el" href="a00079.html">DeciderToPhyInterface</a> *<a class="el" href="a00070.html#ac0f72556cb799d883b4219cab58320bb">phy</a>, double sensitivity, int myIndex, bool bDebug)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a5ed56dc12cece481ab983da1853daff4">initFromMap</a> (const <a class="el" href="a00070.html#a7f3ee545f2ae8b0d8d1814c98917f5b6">ParameterMap</a> &amp;params)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the decider from XML map data.  <a href="#a5ed56dc12cece481ab983da1853daff4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa8d099cd7a5ade60ca70a291239bdc78"></a><!-- doxytag: member="ThresholdDecider::processSignal" ref="aa8d099cd7a5ade60ca70a291239bdc78" args="(airframe_ptr_t frame)" -->
virtual simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#aa8d099cd7a5ade60ca70a291239bdc78">processSignal</a> (<a class="el" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> frame)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">this method is called by the BasePhylayer whenever it gets a AirFrame (from another phy or self scheduled). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="a00044.html">ChannelState</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a245351047ec242c42497116e66b2d902">getChannelState</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A function that returns information about the channel state.  <a href="#a245351047ec242c42497116e66b2d902"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#af67f3a22ff4eaf2e77e2e71d04885040">handleChannelSenseRequest</a> (ChannelSenseRequest *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called by the <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> to hand over a ChannelSenseRequest.  <a href="#af67f3a22ff4eaf2e77e2e71d04885040"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-types"></a>
Protected Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <b>FIRST</b>, 
<b>HEADER_OVER</b>, 
<b>SIGNAL_OVER</b>
 }</td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d05cb7c20aff520229a8a051f1f63d3"></a><!-- doxytag: member="ThresholdDecider::handleNewSignal" ref="a0d05cb7c20aff520229a8a051f1f63d3" args="(Signal *s)" -->
simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a0d05cb7c20aff520229a8a051f1f63d3">handleNewSignal</a> (<a class="el" href="a00192.html">Signal</a> *s)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">handles Signals passed the first time. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5cca0d77477336f95f56215d7a43c704"></a><!-- doxytag: member="ThresholdDecider::handleHeaderOver" ref="a5cca0d77477336f95f56215d7a43c704" args="(std::map&lt; Signal *, int &gt;::iterator &amp;it)" -->
simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a5cca0d77477336f95f56215d7a43c704">handleHeaderOver</a> (std::map&lt; <a class="el" href="a00192.html">Signal</a> *, int &gt;::iterator &amp;it)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">handles the <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> when passed after after end of the header. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6e559163ddd38ef6256b9faa67a46e63"></a><!-- doxytag: member="ThresholdDecider::handleSignalOver" ref="a6e559163ddd38ef6256b9faa67a46e63" args="(std::map&lt; Signal *, int &gt;::iterator &amp;it, airframe_ptr_t frame)" -->
simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a6e559163ddd38ef6256b9faa67a46e63">handleSignalOver</a> (std::map&lt; <a class="el" href="a00192.html">Signal</a> *, int &gt;::iterator &amp;it, <a class="el" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> frame)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">handles the signal when passed at the end of the signal. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a16c7166b8c0f48e3781cb2524abeff4b"></a><!-- doxytag: member="ThresholdDecider::log" ref="a16c7166b8c0f48e3781cb2524abeff4b" args="(std::string msg)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>log</b> (std::string msg)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a431183db0fe1f31506eec3828fa2271b"></a><!-- doxytag: member="ThresholdDecider::toDecibel" ref="a431183db0fe1f31506eec3828fa2271b" args="(double v)" -->
double&#160;</td><td class="memItemRight" valign="bottom"><b>toDecibel</b> (double v)</td></tr>
<tr><td class="memTemplParams" colspan="2"><a class="anchor" id="a254419dee9f58c5f9635ed1d83b572e0"></a><!-- doxytag: member="ThresholdDecider::toString" ref="a254419dee9f58c5f9635ed1d83b572e0" args="(T v, unsigned int length)" -->
template&lt;typename T &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">std::string&#160;</td><td class="memTemplItemRight" valign="bottom"><b>toString</b> (T v, unsigned int length)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a80b787aa1e09c73d4058e4bf18f1b81a"></a><!-- doxytag: member="ThresholdDecider::toString" ref="a80b787aa1e09c73d4058e4bf18f1b81a" args="(simtime_t_cref v, unsigned int length)" -->
std::string&#160;</td><td class="memItemRight" valign="bottom"><b>toString</b> (simtime_t_cref v, unsigned int length)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4d46b0c578c9e817ea8084f53fc0e8e4"></a><!-- doxytag: member="ThresholdDecider::printMapping" ref="a4d46b0c578c9e817ea8084f53fc0e8e4" args="(const ConstMapping *m) const " -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#a4d46b0c578c9e817ea8084f53fc0e8e4">printMapping</a> (const <a class="el" href="a00058.html">ConstMapping</a> *m) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Quick and ugly printing of a two dimensional mapping. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a79efdf2aeae37558e081ca0850ef9050"></a><!-- doxytag: member="ThresholdDecider::myIndex" ref="a79efdf2aeae37558e081ca0850ef9050" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>myIndex</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab216c5d8999489f418afab2308e606b5"></a><!-- doxytag: member="ThresholdDecider::threshold" ref="ab216c5d8999489f418afab2308e606b5" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><b>threshold</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adba3e2c16d773850acaacf8d7d7bf11d"></a><!-- doxytag: member="ThresholdDecider::currentSignals" ref="adba3e2c16d773850acaacf8d7d7bf11d" args="" -->
std::map&lt; <a class="el" href="a00192.html">Signal</a> *, int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00209.html#adba3e2c16d773850acaacf8d7d7bf11d">currentSignals</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">stores the currently receiving signals together with their current state. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A simple <a class="el" href="a00070.html" title="The basic Decider class.">Decider</a> implementation which only checks for a received signal if the receiving power is above a certain value. </p>
<p>Note: This implementation is only meant to be as a quick and ugly <a class="el" href="a00070.html" title="The basic Decider class.">Decider</a> to demonstrate (and print) how the AnalogueModels affect the signal. You should not take it as template for a real Decider!</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00203.html" title="Decider implementation which decides a signals correctness by checking its SNR against a threshold...">SNRThresholdDecider</a> for a simple <a class="el" href="a00070.html" title="The basic Decider class.">Decider</a> implementation or take a look at the "How to write your own Decider" tutorial at the MiXiM wiki. </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a245351047ec242c42497116e66b2d902"></a><!-- doxytag: member="ThresholdDecider::getChannelState" ref="a245351047ec242c42497116e66b2d902" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="a00044.html">ChannelState</a> ThresholdDecider::getChannelState </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A function that returns information about the channel state. </p>
<p>It is an alternative for the MACLayer in order to obtain information immediately (in contrast to sending a ChannelSenseRequest, i.e. sending a cMessage over the OMNeT-control-channel) </p>

<p>Reimplemented from <a class="el" href="a00070.html#aa9f0dcd955639fa2c16233f4654a82bc">Decider</a>.</p>
<div class="fragment"><pre class="fragment">                                               {
    <span class="keywordflow">return</span> <a class="code" href="a00044.html" title="Provides information about the current state of the channel:">ChannelState</a>(<span class="keyword">false</span>, 0);
  }
</pre></div>
</div>
</div>
<a class="anchor" id="af67f3a22ff4eaf2e77e2e71d04885040"></a><!-- doxytag: member="ThresholdDecider::handleChannelSenseRequest" ref="af67f3a22ff4eaf2e77e2e71d04885040" args="(ChannelSenseRequest *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual simtime_t ThresholdDecider::handleChannelSenseRequest </td>
          <td>(</td>
          <td class="paramtype">ChannelSenseRequest *&#160;</td>
          <td class="paramname"><em>request</em></td><td>)</td>
          <td><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function is called by the <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> to hand over a ChannelSenseRequest. </p>
<p>The MACLayer is able to send a ChannelSenseRequest to the <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> that calls this function with it and is returned a time point when to re-call this function with the specific ChannelSenseRequest.</p>
<p>The <a class="el" href="a00070.html" title="The basic Decider class.">Decider</a> puts the result (<a class="el" href="a00044.html" title="Provides information about the current state of the channel:">ChannelState</a>) to the ChannelSenseRequest and "answers" by calling the "sendControlMsg"-function on the <a class="el" href="a00079.html" title="This class is the interface for a Decider to the BasePhyLayer.">DeciderToPhyInterface</a>, i.e. telling the <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> to send it back. </p>

<p>Reimplemented from <a class="el" href="a00070.html#a93548ff29f4d880ed488785509dd4dd9">Decider</a>.</p>

<p>References <a class="el" href="a00070.html#a7fbb5a5f14ae118e40d7db1903be6d51">Decider::notAgain</a>.</p>
<div class="fragment"><pre class="fragment">                                                                    {
    <span class="keywordflow">return</span> <a class="code" href="a00070.html#a7fbb5a5f14ae118e40d7db1903be6d51" title="simtime that tells the Phy-Layer not to pass an AirFrame again">Decider::notAgain</a>;
  }
</pre></div>
</div>
</div>
<a class="anchor" id="a5ed56dc12cece481ab983da1853daff4"></a><!-- doxytag: member="ThresholdDecider::initFromMap" ref="a5ed56dc12cece481ab983da1853daff4" args="(const ParameterMap &amp;params)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThresholdDecider::initFromMap </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00070.html#a7f3ee545f2ae8b0d8d1814c98917f5b6">ParameterMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em></td><td>)</td>
          <td><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialize the decider from XML map data. </p>
<p>This method should be defined for generic decider initialization.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameter map which was filled by XML reader.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the initialization was successfully. </dd></dl>

<p>Reimplemented from <a class="el" href="a00070.html#ae19a201633e5b2bf2d545921049b4f26">Decider</a>.</p>
<div class="fragment"><pre class="fragment">                                                       {
    <span class="keywordtype">bool</span>                         bInitSuccess = <span class="keyword">true</span>;
    ParameterMap::const_iterator it           = params.find(<span class="stringliteral">&quot;threshold&quot;</span>);
    <span class="keywordflow">if</span>(it != params.end()) {
      threshold = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
      opp_warning(<span class="stringliteral">&quot;ERROR: No threshold parameter defined for ThresholdDecider!&quot;</span>);
        bInitSuccess = <span class="keyword">false</span>;
    }
    <span class="keywordflow">return</span> <a class="code" href="a00209.html#a5ed56dc12cece481ab983da1853daff4" title="Initialize the decider from XML map data.">Decider::initFromMap</a>(params) &amp;&amp; bInitSuccess;
  }
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/examples/analogueModels/<a class="el" href="a00237_source.html">ThresholdDecider.h</a></li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00209.html">ThresholdDecider</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:33 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
